package Server.map;

public class BoxField {

	private Box[][] boxes;
	private int originX;
	private int originY;
	
	public BoxField(int size, int originX, int originY){
		this.boxes = new Box[size][];
		for (int i = 0;i < size;i++)
			this.boxes[i] = new Box[size];
		
		this.originX = originX;
		this.originY = originY;
	}
	
	public Box get(int X, int Y){
		try{
			return this.boxes[this.originX + X][this.originY - Y];
		} catch (IndexOutOfBoundsException e){
			return null;
		} catch (NullPointerException f){
			return null;
		}
	}
	
	public void setBox(Box b){
		try{
			this.boxes[this.originX + b.getX()][this.originY - b.getY()] = b;
		} catch (IndexOutOfBoundsException e){
			throw new IllegalArgumentException();
		}
	}
	
	
}
